<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // function* fn() {
        //     // console.log(1);
        //     yield '1'
        //     // console.log(2);
        //     yield '2'
        //     // console.log(3);
        //     yield '3'
        //     // console.log(4);
        // }
        // let iterator = fn()
        // iterator.next() //1
        // iterator.next() //2
        // iterator.next() //3
        // iterator.next() //4

        // for (const e of fn()) {
        //     console.log(e);
        // }



        function* fn(arg) {
            console.log(arg);
            let one = yield 1
            console.log(one);
            let two = yield 2
            console.log(two);
            let three = yield 3
            console.log(three);
        }
        let iterator = fn('a')
        console.log(iterator.next())
        console.log(iterator.next('b'))
        console.log(iterator.next('c'))
        console.log(iterator.next('d'))
    </script>
</body>

</html>